#ifndef CSTATEROOM_H
#define CSTATEROOM_H

#include "CState.h"

#define MAX_PLAYERS 2

class CMinion;
class CStateGame;

class CStateRoom : public CState
{
  public:
    CStateRoom(CGameManager * mgr);
    virtual ~CStateRoom();

    void init();
    void close();
    void run();
    void enable();
    void disable();

    //! Event Receiving Methods
    void OnClientPacketReceived(Packet *packet);

    void OnServerPacketReceived(Packet *packet);

    //! Called when other GUI events happens
    bool OnGUIEvent(const SEvent& event);

    //! Called when a GUI button
    bool OnButtonClick(s32 id);

    //! Start Game
    void startGame();

    //! Update Image / Icon of the minion
    void updateIcon();

    void reqOverlordData();

    void ackOverlordData(BitStream *bs);

    void synchronizeClient();

    void reqAddMinion();

    void ackAddMinion(BitStream *bs);

    void reqRemoveMinion();

    void ackRemoveMinion(BitStream *bs);

    void reqStartGame();

    void ackStartGame(BitStream *bs);
  protected:
  private:
    IGUIImage* minionPic;

    IGUIStaticText *txtPlayer[MAX_PLAYERS];

    IGUIListBox *lstMinion;
    IGUIListBox *lstPlayer[MAX_PLAYERS];

    vector <CMinion *> vPlayerMinion[MAX_PLAYERS];

    vector <CMinion *> vListMinion;

    vector <f32> vPositionX;
    vector <f32> vPositionZ;

    void preparePosition();

    CStateGame *game;

    enum GUI_ID
    {
      BTN_POPSTATE,
      BTN_ADD_MINION,
      BTN_REMOVE_MINION,
      BTN_START_GAME,

      LST_MINION
    };

};

#endif // CSTATEMAINMENU_H
